package com.gxar.quick.ar.server.base.controller;

import com.gxar.common.entity.Result;
import com.gxar.common.entity.SlippageResult;
import com.gxar.common.entity.login.LoginUserThread;
import com.gxar.common.entity.login.UserProfile;
import com.gxar.quick.ar.server.base.model.combo.vo.request.ComboListRequest;
import com.gxar.quick.ar.server.base.model.combo.vo.response.ComboListResponse;
import com.gxar.quick.ar.server.db.service.ComboService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @author linsy
 * @version 1.0
 * @created 2023/11/8 09:34
 */
@Api(tags = "套餐接口")
@RestController
@RequestMapping("/api/combo")
@RequiredArgsConstructor
@Slf4j
public class ComboController {

    private final ComboService comboService;

    @ApiImplicitParams({
            @ApiImplicitParam(name = "next_id", value = "下一个查询的id", dataType = "string"),
    })
    @GetMapping("")
    public Result<SlippageResult<ComboListResponse>> getList(@RequestParam(name = "next_id", required = false) String nextId) {
        UserProfile userProfile = LoginUserThread.get();
        SlippageResult<ComboListResponse> comboListResponse = comboService.list(userProfile, nextId);
        return Result.success(comboListResponse);
    }

}
